

package com.hazelcast.map.impl;

import com.hazelcast.internal.util.ConstructorFunction;
import com.hazelcast.spi.impl.NodeEngine;

/**
 * Helper which is used to create a {@link MapService} object.
 */
public final class MapServiceConstructor {

    private static final ConstructorFunction<NodeEngine, MapService> DEFAULT_MAP_SERVICE_CONSTRUCTOR = nodeEngine -> {
        MapServiceContext defaultMapServiceContext = new MapServiceContextImpl(nodeEngine);
        MapServiceFactory factory = new DefaultMapServiceFactory(nodeEngine, defaultMapServiceContext);
        return factory.createMapService();
    };

    private MapServiceConstructor() {
    }

    /**
     * Returns a {@link ConstructorFunction Constructor} which will be used to create a  {@link MapService} object.
     *
     * @return {@link ConstructorFunction Constructor} which will be used to create a  {@link MapService} object.
     */
    public static ConstructorFunction<NodeEngine, MapService> getDefaultMapServiceConstructor() {
        return DEFAULT_MAP_SERVICE_CONSTRUCTOR;
    }
}
